package com.qing.springbootinit.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qing.springbootinit.common.BaseResponse;
import com.qing.springbootinit.common.ResultUtils;
import com.qing.springbootinit.model.dto.chat.ChatQueryRequest;
import com.qing.springbootinit.model.dto.chat.ChatRoomDto;
import com.qing.springbootinit.service.ChatroomService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

// * @author <a href="https://github.com/qingfengzy">qingfengzy</a>

@RestController
@RequestMapping("/chatRoom")
public class ChatRoomController {

    @Resource
    private ChatroomService chatroomService;



    @PostMapping()
    public BaseResponse<Page<ChatRoomDto>> getRoomList(@RequestBody ChatQueryRequest chatQueryRequest, HttpServletRequest request){
        Page<ChatRoomDto> chatRoomDtoPage = chatroomService.listCharRoomPage(chatQueryRequest, request);
        return ResultUtils.success(chatRoomDtoPage);
    }
}
